package com.ac.model;

import com.ac.util.StrUtils;

import cn.hutool.core.util.IdUtil;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
public class ModelBase {

	String id;

	String parentId;

	long createTime;
	long updateTime;

	public void insert() {
		if (!StrUtils.isEmpty(this.id)) return;
		this.id = IdUtil.objectId() + StrUtils.getRandomId();
		this.createTime = System.currentTimeMillis();
	}

	public void update() {
		this.updateTime = System.currentTimeMillis();
	}

}
